// vue + ts 关于工具函数的封装及导出
// https://blog.csdn.net/qq_36947174/article/details/102468157


const remSize = 100
const UIWidth = 1440
const maxWidth = 1440
const minWidth = 320

const getFontSize = function (screenWidth: number) {
	return screenWidth * remSize / UIWidth + 'px'
}
 

interface Rem {
	[propName: string]: any
  }
  const rem: Rem = {}
   
   
   
  rem.getSize = () => {
		const Ohtml = document.documentElement
		const screenWidth = Ohtml.clientWidth
		if (screenWidth < minWidth) {
			Ohtml.style.fontSize = getFontSize(minWidth)
		} else if (screenWidth > maxWidth) {
			Ohtml.style.fontSize = getFontSize(maxWidth)
		} else {
			Ohtml.style.fontSize = getFontSize(screenWidth)
		}
	}
   
   
  export default rem

 